package com.byhealth.dao.impl;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.byhealth.dao.TestDao;

@Repository
public class TestDaoImpl implements TestDao{

	@Resource(name = "jdbcTemplate")
	JdbcTemplate jdbcTemplate;
	
	/**
	 * 测试事务
	 * @return
	 */
	public Boolean test(){
		String sql = " insert into test (name) values('第一条') ";
		int i = jdbcTemplate.update(sql);
		
		sql = " insert123 into test (name) values('第二条') ";
		 i = jdbcTemplate.update(sql);
		return true;
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	
	
}
